﻿namespace PLM.ConfigurationCenter.EventBus.Eventbus {
    /// <summary>
    /// 订阅信息模型
    /// </summary>
    public class SubscriptionInfo {
        /// <summary>
        /// 
        /// </summary>
        public bool IsDynamic { get; }
        /// <summary>
        /// 
        /// </summary>
        public Type HandlerType { get; }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="isDynamic"></param>
        /// <param name="handlerType"></param>
        private SubscriptionInfo(bool isDynamic, Type handlerType) {
            IsDynamic = isDynamic;
            HandlerType = handlerType;
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="handlerType"></param>
        /// <returns></returns>
        public static SubscriptionInfo Dynamic(Type handlerType) {
            return new SubscriptionInfo(true, handlerType);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="handlerType"></param>
        /// <returns></returns>
        public static SubscriptionInfo Typed(Type handlerType) {
            return new SubscriptionInfo(false, handlerType);
        }
    }
}
